package org.iWMS.core.web;

import org.apache.log4j.Logger;
import org.iWMS.core.domain.User;
import org.iWMS.core.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created with IntelliJ IDEA.
 * User: issuser
 * Date: 13-6-6
 * Time: 下午2:30
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping(value="/{userId}")
public class UserController {
    private final static Logger logger=Logger.getLogger(UserController.class);
    @Autowired
    private UserService userService;

    @RequestMapping(value="/setting")
    public String setting(@PathVariable String userId,ModelMap mm) {
        mm.addAttribute("user",userService.findUserByUserName(userId));
        return "user/setting";
    }
    @RequestMapping(value = "/updateInfo")
    public String updateInfo(User user) {
        logger.info("用户"+user.getUserName()+"修改帐户信息" + "  "+user.getUserRealName());
        userService.updateInfo(user);
        return "success";
    }
    @RequestMapping(value="/reset-password")
    public String resetPassword() {
        return "user/resetPassword";
    }
}
